package cn.rongdao.jrkabao.ui.message.system;

import android.content.Context;

import com.mifengkong.frtools.http.request.callback.FRBaseObserver;
import com.mifengkong.frtools.ui.activity.FRStartActivity;

import java.util.List;

import cn.rongdao.jrkabao.bean.message.SystemMessageBean;
import cn.rongdao.jrkabao.model.message.SystemMessageModel;
import cn.rongdao.jrkabao.ui.message.BaseMessageActivity;

/**
 * Created by jack on 2017/8/16
 */

public class SystemMessageActivity extends BaseMessageActivity {

    public static void start(Context context) {
        FRStartActivity.start(context, SystemMessageActivity.class);
    }

    @Override
    protected void getMessageData() {
        SystemMessageModel.getInstance().execute(new FRBaseObserver<List<SystemMessageBean>>(this) {
            @Override
            protected void onBaseNext(List<SystemMessageBean> data) {
                if (data.size() <= 0) {
                    runUI(0);
                } else {
                    runUI(1);
                }
                mAdapter.setDataList(data);
            }

            @Override
            protected void onBaseError(Throwable t) {
                super.onBaseError(t);
                runUI(0);
            }
        });
    }

    @Override
    protected String getTitleName() {
        return "系统消息";
    }
}
